import { request, formRequest } from '../utils/request';

export async function fetchRecommList(params) {
  return request('adminapi/admin/getAppRecommPageList', {
    method: 'POST',
    body: params,
  });
}

export async function changeSts(params) {
  return request('adminapi/admin/setAppRecommPageSts', {
    method: 'POST',
    body: params,
  });
}

export async function addRecommPage(params) {
  return request('adminapi/admin/addAppRecommPage', {
    method: 'POST',
    body: params,
  });
}


export async function deletePadRecomm(params) {
  return request('adminapi/admin/delAppRecommPage', {
    method: 'POST',
    body: params,
  });
}

export async function fetchRecommPage(params) {
  return request('adminapi/admin/getAppRecommPage', {
    method: 'POST',
    body: params,
  });
}

export async function addRecommPageLayout(params) {
  return request('adminapi/admin/addAppRecommLayout', {
    method: 'POST',
    body: params,
  });
}

export async function editPageLayout(params) {
  return request('adminapi/admin/updateAppRecommPage', {
    method: 'POST',
    body: params,
  });
}

export async function deletePageLayout(params) {
  return request('adminapi/admin/delAppRecommLayout', {
    method: 'POST',
    body: params,
  });
}

export async function fetchLayoutDetail(params) {
  return request('adminapi/admin/getAppRecommDetailList', {
    method: 'POST',
    body: params,
  });
}

export async function addLayoutDetail(params) {
  let file = params.name;
  delete params.name;
  delete params.goodsName;

  return formRequest('adminapi/admin/upload/addAppRecommDetail', {
    method: 'POST',
    body: params,
  },
    file
  );
}

export async function editLayoutDetail(params) {
  let file = params.name;
  delete params.name;
  delete params.goodsName;

  return formRequest('adminapi/admin/upload/setAppRecommDetail', {
    method: 'POST',
    body: params,
  },
    file
  );
}

